﻿/***********************************************************************
 * <copyright file="NewsAuthRepository.cs" company="BSD JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoang Bich Son 
 * Email:    sonhb@newman.vn
 * Website:
 * Create Date: Sunday, April 13, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using DXWebApplication.Repositories.Core;
using DXWebApplication.Repositories.Core.News;
using DXWebApplication.NewsServiceReference;

namespace DXWebApplication.Repositories.Implementations
{
    public class NewsAuthRepository : NewsRepositoryBase, INewsAuthRepository
    {

        /// <summary>
        /// Gets the token.
        /// </summary>
        /// <returns></returns>
        public string GetToken()
        {
            var request = new TokenRequest { RequestId = NewsRequestHelper.RequestId, ClientTag = NewsRequestHelper.ClientTag, UserName = NewsRequestHelper.UserName };
            var response = NewsServiceClient.GetToken(request);

            Correlate(request, response);

            return response.AccessToken;
        }
    }
}